from rest_framework.pagination import PageNumberPagination, CursorPagination


class MyPageNumberPagination(PageNumberPagination):
    # 普通分页
    page_size = 2  # 每页显示5条数据
    page_query_param = 'page'  # 查询参数
    page_size_query_description = 'size'
    max_page_size = 30  # 最大每页显示五条数据
    ordering = '-id'


class MyPageNumberPaginationCursor(CursorPagination):
    # 游标分页
    cursor_query_param = 'cursor'               # 查询方式
    page_size = 5                               # 每页显示多少条
    ordering = '-id'                            # 排序方式,按什么排序
    page_size_query_description = None          # 查询的时候指定每页显示多少条
    max_page_size = 10                          # 每页最多显示多少


class MySingalPageNumberPaginationCursor(CursorPagination):
    # 游标分页
    cursor_query_param = 'cursor'               # 查询方式
    page_size = 3                               # 每页显示多少条
    ordering = '-id'                            # 排序方式,按什么排序
    page_size_query_description = None          # 查询的时候指定每页显示多少条
    max_page_size = 10                          # 每页最多显示多少
